<SCRIPT language=JavaScript>
var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
</SCRIPT>
<?
session_start();
include("db.php");
if(!isset($_SESSION['login'])){
	echo "<script>window.location='home.php'</script>";
}
else if(isset($_POST['oldsenha'])){
$login=$_SESSION['login'];
$oldsenha=$_POST['oldsenha'];
$newsenha=$_POST['newsenha'];
$versenha=mssql_query("SELECT * FROM MEMB_INFO Where memb__pwd='$oldsenha' AND memb___id='$login'");
$versenha=mssql_num_rows($versenha);
if($versenha>0){ 
$query=mssql_query("UPDATE MEMB_INFO SET memb__pwd='$newsenha' WHERE memb___id='$login'");
echo "<script>alert('Senha alterada com sucesso!');window.location='manager.php'</script>";
 }
else{
echo "<script>alert('Erro! confira sua senha atual!');window.location='senha.php'</script>";
 }
}

?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.camposs {	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9px;
	background-color: #2b2b2b;
	border: 1px solid #FFFFFF;
	color: #FFFFFF;
}
.camposs2 {	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9px;
	background-color: #999999;
	border: 1px solid #666666;
}
body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	color: #FFFFFF;
	font-size: 12px;
}
body {
  scrollbar-arrow-color: #FF9900;
  scrollbar-3dlight-color: #FFFFFF;
  scrollbar-highlight-color: #000000;
  scrollbar-face-color: #FFFFFF;
  scrollbar-shadow-color: #000000;
  scrollbar-darkshadow-color: #FFFFFF;
  scrollbar-track-color: #cdcdcd;
	background-color: #ffffff;
}
-->
<script>
function send(){
	erro='';
	if(document.form1.oldsenha.value==''){ erro+='\n'; }
	if(document.form1.newsenha.value==''){ erro+='\n'; }
	if(erro!=''){ alert('Preencha todos os campos!') }
	else { document.form1.submit() }
}
</script>
.style1 {color: #000000}
.style1 {color: #000000}
</style>
<body background=images/fundo2.JPG>
<form name="form1" method="post" action="">
<table width=300 border="0" align="center">
  <tr>
    <td><span class="style1">Senha atual:</span></td>
    <td><input type="text" class=camposs name="oldsenha"></td>
    </tr>
  <tr>
    <td><span class="style1">Nova senha:</span></td>
    <td><input type="password" class=camposs name="newsenha"></td>
    </tr>
  <tr>
    <td colspan=2 align="center">
      <input name="Mudar" type="submit" id="Mudar" class=camposs2 value="Mudar Minha Senha!!!" OnClick="send()">
    </div></td>
    </tr>
</table>
</form>
